<?php

/**
 * Entity form base class.
 *
 * @method Entity getObject() Returns the current form's model object
 *
 * @package    Redsea20
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseEntityForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'firstname'       => new sfWidgetFormInputText(),
      'lastname'        => new sfWidgetFormInputText(),
      'emailaddress'    => new sfWidgetFormInputText(),
      'university'      => new sfWidgetFormTextarea(),
      'position'        => new sfWidgetFormTextarea(),
      'address'         => new sfWidgetFormTextarea(),
      'contact'         => new sfWidgetFormInputText(),
      'gender'          => new sfWidgetFormInputText(),
      'birthdate'       => new sfWidgetFormDate(),
      'entitytyperefid' => new sfWidgetFormInputText(),
      'picture'         => new sfWidgetFormTextarea(),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'firstname'       => new sfValidatorString(array('max_length' => 50)),
      'lastname'        => new sfValidatorString(array('max_length' => 50)),
      'emailaddress'    => new sfValidatorString(array('max_length' => 100)),
      'university'      => new sfValidatorString(),
      'position'        => new sfValidatorString(),
      'address'         => new sfValidatorString(),
      'contact'         => new sfValidatorString(array('max_length' => 50)),
      'gender'          => new sfValidatorString(array('max_length' => 6)),
      'birthdate'       => new sfValidatorDate(),
      'entitytyperefid' => new sfValidatorInteger(),
      'picture'         => new sfValidatorString(array('required' => false)),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('entity[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Entity';
  }

}
